package com.erp.organization.ao.idl;

import java.util.Map;
import java.util.Set;
import java.util.Vector;

import com.erp.organization.ao.idl.OrganizationPo.BranchPo;
import com.erp.organization.ao.idl.OrganizationPo.OrganizationFilterPo;
import com.paipai.lang.uint32_t;
import com.paipai.lang.uint64_t;
import com.paipai.util.annotation.ApiProtocol;
import com.paipai.util.annotation.Field;
import com.paipai.util.annotation.HeadApiProtocol;

/**
 * 云ERP组织机构信息系统，组织机构ao
 * 
 * @author hadeswang
 * @version 1.0, 2013-10-12
 * 
 */

@HeadApiProtocol(cPlusNamespace = "erp::organization::ao", needInit = true, needReset = true, serviceType="ao", platformType="erp")
public class OrganizationAo
{
	@ApiProtocol(cmdid = "0xC04D1801L", desc = "添加/修改分支机构；传入分支机构ID不为0时则进行修改，反之则进行添加；不能进行逻辑删除")
	class ModifyBranch
	{
		class Req
		{
			@Field(desc = "机器码，必填 ")
			String machineKey;

			@Field(desc = "调用来源，必填 ")
			String source;

			@Field(desc = "场景ID，必填 ")
			uint32_t sceneId;
			
			@Field(desc = "功能选项，扩展选填 ")
			uint32_t option;
			
			@Field(desc = "分支机构PO，必填 ")
			BranchPo branch;

			@Field(desc = "请求保留字 ")
			String inReserve;
		}

		class Resp
		{
			@Field(desc = "错误信息 ")
			String errmsg;
			
			@Field(desc = "返回新增或修改后的分支机构PO，必填 ")
			BranchPo branchBack;

			@Field(desc = "返回保留字  ")
			String outReserve;
		}
	};

	@ApiProtocol(cmdid = "0xC04D1802L", desc = "删除分支机构（逻辑）")
	class DeleteBranch
	{
		class Req
		{
			@Field(desc = "机器码，必填 ")
			String machineKey;

			@Field(desc = "调用来源，必填 ")
			String source;

			@Field(desc = "场景ID，必填 ")
			uint32_t sceneId;
			
			@Field(desc = "功能选项，扩展选填 ")
			uint32_t option;
			
			@Field(desc = "需删除的分支机构的ID，必填 ")
			Set<uint64_t> branchId;

			@Field(desc = "请求保留字 ")
			String inReserve;
		}

		class Resp
		{
			@Field(desc = "错误信息 ")
			String errmsg;
			
			@Field(desc = "删除失败的错误码")
			Map<uint64_t,uint32_t> errorCode;
			
			@Field(desc = "删除失败的错误信息")
			Map<uint64_t,String> errorMsg;
			
			@Field(desc = "返回保留字  ")
			String outReserve;
		}
	};
	
	@ApiProtocol(cmdid = "0xC04D1803L", desc = "根据分支机构ID批量获取分支机构信息")
	class GetBranch
	{
		class Req
		{
			@Field(desc = "机器码，必填 ")
			String machineKey;

			@Field(desc = "调用来源，必填 ")
			String source;

			@Field(desc = "场景ID，必填 ")
			uint32_t sceneId;
			
			@Field(desc = "功能选项，扩展选填 ")
			uint32_t option;
			
			@Field(desc = "需获取的分支机构的ID，必填 ")
			Set<uint64_t> branchId;

			@Field(desc = "请求保留字 ")
			String inReserve;
		}

		class Resp
		{
			@Field(desc = "错误信息 ")
			String errmsg;
			
			@Field(desc = "获取失败的错误码")
			Map<uint64_t,uint32_t> errorCode;
			
			@Field(desc = "获取失败的错误信息")
			Map<uint64_t,String> errorMsg;
			
			@Field(desc = "获取成功的分支机构信息")
			Map<uint64_t,BranchPo> branch;
			
			@Field(desc = "返回保留字  ")
			String outReserve;
		}
	};
	
	@ApiProtocol(cmdid = "0xC04D1804L", desc = "根据过滤条件查询支机构列表信息")
	class FindBranch
	{
		class Req
		{
			@Field(desc = "机器码，必填 ")
			String machineKey;

			@Field(desc = "调用来源，必填 ")
			String source;

			@Field(desc = "场景ID，必填 ")
			uint32_t sceneId;
			
			@Field(desc = "功能选项，扩展选填 ")
			uint32_t option;
			
			@Field(desc = "过滤器，必填 ")
			OrganizationFilterPo filter;

			@Field(desc = "请求保留字 ")
			String inReserve;
		}

		class Resp
		{
			@Field(desc = "错误信息 ")
			String errmsg;
			
			@Field(desc = "分支机构总数")
			uint32_t total;
			
			@Field(desc = "分支机构列表信息")
			Vector<BranchPo> branch;
			
			@Field(desc = "返回保留字  ")
			String outReserve;
		}
	};
}
